#  Copyright (c) 2014-present, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed as defined on the LICENSE file found in the
#  root directory of this source tree.

load("//tools/build_defs/oss/osquery:cxx.bzl", "osquery_cxx_library")
load("//tools/build_defs/oss/osquery:native.bzl", "osquery_target")
load("//tools/build_defs/oss/osquery:platforms.bzl", "FREEBSD")

osquery_cxx_library(
    name = "extensions",
    srcs = [
        "extensions.cpp",
    ],
    header_namespace = "osquery/extensions",
    link_whole = True,
    tests = [
        osquery_target("osquery/extensions/tests:extensions_tests"),
    ],
    visibility = ["PUBLIC"],
    deps = [
        ":extensions_interface",
        osquery_target("osquery/core:core"),
        osquery_target("osquery/process:process"),
        osquery_target("osquery/utils:utils"),
        osquery_target("osquery/utils/conversions:conversions"),
    ],
)

osquery_cxx_library(
    name = "impl_thrift",
    srcs = [
        "impl_thrift.cpp",
    ],
    exported_post_platform_linker_flags = [
        (
            FREEBSD,
            [
                "-lthrift",
            ],
        ),
    ],
    link_whole = True,
    visibility = ["PUBLIC"],
    deps = [
        ":extensions_interface",
        osquery_target("osquery/core:core"),
        osquery_target("osquery/extensions/thrift:osquery-cpp2"),
        osquery_target("osquery/process:process"),
        osquery_target("osquery/utils:utils"),
        osquery_target("osquery/utils/conversions:conversions"),
    ],
)

osquery_cxx_library(
    name = "extensions_interface",
    srcs = [
        "interface.cpp",
    ],
    header_namespace = "osquery/extensions",
    exported_headers = [
        "interface.h",
    ],
    link_whole = True,
    visibility = ["PUBLIC"],
    deps = [
        osquery_target("osquery:headers"),
        osquery_target("osquery/filesystem:osquery_filesystem"),
    ],
)
